

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="Description" content="scikit-learn: machine learning in Python">

  
  <title>sklearn.svm.SVC &mdash; scikit-learn 0.22 documentation</title>
  
  <link rel="canonical" href="http://scikit-learn.org/stable/modules/generated/sklearn.svm.SVC.html" />

  
  <link rel="shortcut icon" href="../../_static/favicon.ico"/>
  

  <link rel="stylesheet" href="../../_static/css/vendor/bootstrap.min.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/gallery.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />
<script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
<script src="../../_static/jquery.js"></script> 
</head>
<body>
<nav id="navbar" class="sk-docs-navbar navbar navbar-expand-md navbar-light bg-light py-0">
  <div class="container-fluid sk-docs-container px-0">
      <a class="navbar-brand py-0" href="../../index.html">
        <img
          class="sk-brand-img"
          src="../../_static/scikit-learn-logo-small.png"
          alt="logo"/>
      </a>
    <button
      id="sk-navbar-toggler"
      class="navbar-toggler"
      type="button"
      data-toggle="collapse"
      data-target="#navbarSupportedContent"
      aria-controls="navbarSupportedContent"
      aria-expanded="false"
      aria-label="Toggle navigation"
    >
      <span class="navbar-toggler-icon"></span>
    </button>

    <div class="sk-navbar-collapse collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav mr-auto">
        <li class="nav-item">
          <a class="sk-nav-link nav-link" href="../../install.html">Install</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link" href="../../user_guide.html">User Guide</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link" href="../classes.html">API</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link" href="../../auto_examples/index.html">Examples</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../getting_started.html">Getting Started</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../tutorial/index.html">Tutorial</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../glossary.html">Glossary</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../developers/index.html">Development</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../faq.html">FAQ</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../related_projects.html">Related packages</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../roadmap.html">Roadmap</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="../../about.html">About us</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="https://github.com/scikit-learn/scikit-learn">GitHub</a>
        </li>
        <li class="nav-item">
          <a class="sk-nav-link nav-link nav-more-item-mobile-items" href="https://scikit-learn.org/dev/versions.html">Other Versions</a>
        </li>
        <li class="nav-item dropdown nav-more-item-dropdown">
          <a class="sk-nav-link nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">More</a>
          <div class="dropdown-menu" aria-labelledby="navbarDropdown">
              <a class="sk-nav-dropdown-item dropdown-item" href="../../getting_started.html">Getting Started</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../tutorial/index.html">Tutorial</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../glossary.html">Glossary</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../developers/index.html">Development</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../faq.html">FAQ</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../related_projects.html">Related packages</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../roadmap.html">Roadmap</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="../../about.html">About us</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="https://github.com/scikit-learn/scikit-learn">GitHub</a>
              <a class="sk-nav-dropdown-item dropdown-item" href="https://scikit-learn.org/dev/versions.html">Other Versions</a>
          </div>
        </li>
      </ul>
      <div id="searchbox" role="search">
          <div class="searchformwrapper">
          <form class="search" action="../../search.html" method="get">
            <input class="sk-search-text-input" type="text" name="q" aria-labelledby="searchlabel" />
            <input class="sk-search-text-btn" type="submit" value="Go" />
          </form>
          </div>
      </div>
    </div>
  </div>
</nav>
<div class="d-flex" id="sk-doc-wrapper">
    <input type="checkbox" name="sk-toggle-checkbox" id="sk-toggle-checkbox">
    <label id="sk-sidemenu-toggle" class="sk-btn-toggle-toc btn sk-btn-primary" for="sk-toggle-checkbox">Toggle Menu</label>
    <div id="sk-sidebar-wrapper" class="border-right">
      <div class="sk-sidebar-toc-wrapper">
        <div class="sk-sidebar-toc-logo">
          <a href="../../index.html">
            <img
              class="sk-brand-img"
              src="../../_static/scikit-learn-logo-small.png"
              alt="logo"/>
          </a>
        </div>
        <div class="btn-group w-100 mb-2" role="group" aria-label="rellinks">
            <a href="sklearn.svm.OneClassSVM.html" role="button" class="btn sk-btn-rellink py-1" sk-rellink-tooltip="sklearn.svm.OneClassSVM">Prev</a><a href="../classes.html" role="button" class="btn sk-btn-rellink py-1" sk-rellink-tooltip="API Reference">Up</a>
            <a href="sklearn.svm.SVR.html" role="button" class="btn sk-btn-rellink py-1" sk-rellink-tooltip="sklearn.svm.SVR">Next</a>
        </div>
        <div class="alert alert-danger p-1 mb-2" role="alert">
          <p class="text-center mb-0">
          <strong>scikit-learn 0.22</strong><br/>
          <a href="http://scikit-learn.org/dev/versions.html">Other versions</a>
          </p>
        </div>
        <div class="alert alert-warning p-1 mb-2" role="alert">
          <p class="text-center mb-0">
            Please <a class="font-weight-bold" href="../../about.html#citing-scikit-learn"><string>cite us</string></a> if you use the software.
          </p>
        </div>
          <div class="sk-sidebar-toc">
            <ul>
<li><a class="reference internal" href="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">sklearn.svm</span></code>.SVC</a><ul>
<li><a class="reference internal" href="#examples-using-sklearn-svm-svc">Examples using <code class="docutils literal notranslate"><span class="pre">sklearn.svm.SVC</span></code></a></li>
</ul>
</li>
</ul>

          </div>
      </div>
    </div>
    <div id="sk-page-content-wrapper">
      <div class="sk-page-content container-fluid body px-md-3" role="main">
        
  <div class="section" id="sklearn-svm-svc">
<h1><a class="reference internal" href="../classes.html#module-sklearn.svm" title="sklearn.svm"><code class="xref py py-mod docutils literal notranslate"><span class="pre">sklearn.svm</span></code></a>.SVC<a class="headerlink" href="#sklearn-svm-svc" title="Permalink to this headline">¶</a></h1>
<dl class="class">
<dt id="sklearn.svm.SVC">
<em class="property">class </em><code class="sig-prename descclassname">sklearn.svm.</code><code class="sig-name descname">SVC</code><span class="sig-paren">(</span><em class="sig-param">C=1.0</em>, <em class="sig-param">kernel='rbf'</em>, <em class="sig-param">degree=3</em>, <em class="sig-param">gamma='scale'</em>, <em class="sig-param">coef0=0.0</em>, <em class="sig-param">shrinking=True</em>, <em class="sig-param">probability=False</em>, <em class="sig-param">tol=0.001</em>, <em class="sig-param">cache_size=200</em>, <em class="sig-param">class_weight=None</em>, <em class="sig-param">verbose=False</em>, <em class="sig-param">max_iter=-1</em>, <em class="sig-param">decision_function_shape='ovr'</em>, <em class="sig-param">break_ties=False</em>, <em class="sig-param">random_state=None</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/svm/_classes.py#L438"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.svm.SVC" title="Permalink to this definition">¶</a></dt>
<dd><p>C-Support Vector Classification.</p>
<p>The implementation is based on libsvm. The fit time scales at least
quadratically with the number of samples and may be impractical
beyond tens of thousands of samples. For large datasets
consider using <a class="reference internal" href="sklearn.svm.LinearSVC.html#sklearn.svm.LinearSVC" title="sklearn.svm.LinearSVC"><code class="xref py py-class docutils literal notranslate"><span class="pre">sklearn.svm.LinearSVC</span></code></a> or
<a class="reference internal" href="sklearn.linear_model.SGDClassifier.html#sklearn.linear_model.SGDClassifier" title="sklearn.linear_model.SGDClassifier"><code class="xref py py-class docutils literal notranslate"><span class="pre">sklearn.linear_model.SGDClassifier</span></code></a> instead, possibly after a
<a class="reference internal" href="sklearn.kernel_approximation.Nystroem.html#sklearn.kernel_approximation.Nystroem" title="sklearn.kernel_approximation.Nystroem"><code class="xref py py-class docutils literal notranslate"><span class="pre">sklearn.kernel_approximation.Nystroem</span></code></a> transformer.</p>
<p>The multiclass support is handled according to a one-vs-one scheme.</p>
<p>For details on the precise mathematical formulation of the provided
kernel functions and how <code class="docutils literal notranslate"><span class="pre">gamma</span></code>, <code class="docutils literal notranslate"><span class="pre">coef0</span></code> and <code class="docutils literal notranslate"><span class="pre">degree</span></code> affect each
other, see the corresponding section in the narrative documentation:
<a class="reference internal" href="../svm.html#svm-kernels"><span class="std std-ref">Kernel functions</span></a>.</p>
<p>Read more in the <a class="reference internal" href="../svm.html#svm-classification"><span class="std std-ref">User Guide</span></a>.</p>
<dl class="field-list">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl>
<dt><strong>C</strong><span class="classifier">float, optional (default=1.0)</span></dt><dd><p>Regularization parameter. The strength of the regularization is
inversely proportional to C. Must be strictly positive. The penalty
is a squared l2 penalty.</p>
</dd>
<dt><strong>kernel</strong><span class="classifier">string, optional (default=’rbf’)</span></dt><dd><p>Specifies the kernel type to be used in the algorithm.
It must be one of ‘linear’, ‘poly’, ‘rbf’, ‘sigmoid’, ‘precomputed’ or
a callable.
If none is given, ‘rbf’ will be used. If a callable is given it is
used to pre-compute the kernel matrix from data matrices; that matrix
should be an array of shape <code class="docutils literal notranslate"><span class="pre">(n_samples,</span> <span class="pre">n_samples)</span></code>.</p>
</dd>
<dt><strong>degree</strong><span class="classifier">int, optional (default=3)</span></dt><dd><p>Degree of the polynomial kernel function (‘poly’).
Ignored by all other kernels.</p>
</dd>
<dt><strong>gamma</strong><span class="classifier">{‘scale’, ‘auto’} or float, optional (default=’scale’)</span></dt><dd><p>Kernel coefficient for ‘rbf’, ‘poly’ and ‘sigmoid’.</p>
<ul class="simple">
<li><p>if <code class="docutils literal notranslate"><span class="pre">gamma='scale'</span></code> (default) is passed then it uses
1 / (n_features * X.var()) as value of gamma,</p></li>
<li><p>if ‘auto’, uses 1 / n_features.</p></li>
</ul>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 0.22: </span>The default value of <code class="docutils literal notranslate"><span class="pre">gamma</span></code> changed from ‘auto’ to ‘scale’.</p>
</div>
</dd>
<dt><strong>coef0</strong><span class="classifier">float, optional (default=0.0)</span></dt><dd><p>Independent term in kernel function.
It is only significant in ‘poly’ and ‘sigmoid’.</p>
</dd>
<dt><strong>shrinking</strong><span class="classifier">boolean, optional (default=True)</span></dt><dd><p>Whether to use the shrinking heuristic.</p>
</dd>
<dt><strong>probability</strong><span class="classifier">boolean, optional (default=False)</span></dt><dd><p>Whether to enable probability estimates. This must be enabled prior
to calling <code class="docutils literal notranslate"><span class="pre">fit</span></code>, will slow down that method as it internally uses
5-fold cross-validation, and <code class="docutils literal notranslate"><span class="pre">predict_proba</span></code> may be inconsistent with
<code class="docutils literal notranslate"><span class="pre">predict</span></code>. Read more in the <a class="reference internal" href="../svm.html#scores-probabilities"><span class="std std-ref">User Guide</span></a>.</p>
</dd>
<dt><strong>tol</strong><span class="classifier">float, optional (default=1e-3)</span></dt><dd><p>Tolerance for stopping criterion.</p>
</dd>
<dt><strong>cache_size</strong><span class="classifier">float, optional</span></dt><dd><p>Specify the size of the kernel cache (in MB).</p>
</dd>
<dt><strong>class_weight</strong><span class="classifier">{dict, ‘balanced’}, optional</span></dt><dd><p>Set the parameter C of class i to class_weight[i]*C for
SVC. If not given, all classes are supposed to have
weight one.
The “balanced” mode uses the values of y to automatically adjust
weights inversely proportional to class frequencies in the input data
as <code class="docutils literal notranslate"><span class="pre">n_samples</span> <span class="pre">/</span> <span class="pre">(n_classes</span> <span class="pre">*</span> <span class="pre">np.bincount(y))</span></code></p>
</dd>
<dt><strong>verbose</strong><span class="classifier">bool, default: False</span></dt><dd><p>Enable verbose output. Note that this setting takes advantage of a
per-process runtime setting in libsvm that, if enabled, may not work
properly in a multithreaded context.</p>
</dd>
<dt><strong>max_iter</strong><span class="classifier">int, optional (default=-1)</span></dt><dd><p>Hard limit on iterations within solver, or -1 for no limit.</p>
</dd>
<dt><strong>decision_function_shape</strong><span class="classifier">‘ovo’, ‘ovr’, default=’ovr’</span></dt><dd><p>Whether to return a one-vs-rest (‘ovr’) decision function of shape
(n_samples, n_classes) as all other classifiers, or the original
one-vs-one (‘ovo’) decision function of libsvm which has shape
(n_samples, n_classes * (n_classes - 1) / 2). However, one-vs-one
(‘ovo’) is always used as multi-class strategy.</p>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 0.19: </span>decision_function_shape is ‘ovr’ by default.</p>
</div>
<div class="versionadded">
<p><span class="versionmodified added">New in version 0.17: </span><em>decision_function_shape=’ovr’</em> is recommended.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified changed">Changed in version 0.17: </span>Deprecated <em>decision_function_shape=’ovo’ and None</em>.</p>
</div>
</dd>
<dt><strong>break_ties</strong><span class="classifier">bool, optional (default=False)</span></dt><dd><p>If true, <code class="docutils literal notranslate"><span class="pre">decision_function_shape='ovr'</span></code>, and number of classes &gt; 2,
<a class="reference internal" href="../../glossary.html#term-predict"><span class="xref std std-term">predict</span></a> will break ties according to the confidence values of
<a class="reference internal" href="../../glossary.html#term-decision-function"><span class="xref std std-term">decision_function</span></a>; otherwise the first class among the tied
classes is returned. Please note that breaking ties comes at a
relatively high computational cost compared to a simple predict.</p>
<div class="versionadded">
<p><span class="versionmodified added">New in version 0.22.</span></p>
</div>
</dd>
<dt><strong>random_state</strong><span class="classifier">int, RandomState instance or None, optional (default=None)</span></dt><dd><p>The seed of the pseudo random number generator used when shuffling
the data for probability estimates. If int, random_state is the
seed used by the random number generator; If RandomState instance,
random_state is the random number generator; If None, the random
number generator is the RandomState instance used by <code class="docutils literal notranslate"><span class="pre">np.random</span></code>.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Attributes</dt>
<dd class="field-even"><dl>
<dt><strong>support_</strong><span class="classifier">array-like of shape (n_SV)</span></dt><dd><p>Indices of support vectors.</p>
</dd>
<dt><strong>support_vectors_</strong><span class="classifier">array-like of shape (n_SV, n_features)</span></dt><dd><p>Support vectors.</p>
</dd>
<dt><strong>n_support_</strong><span class="classifier">array-like, dtype=int32, shape = [n_class]</span></dt><dd><p>Number of support vectors for each class.</p>
</dd>
<dt><strong>dual_coef_</strong><span class="classifier">array, shape = [n_class-1, n_SV]</span></dt><dd><p>Coefficients of the support vector in the decision function.
For multiclass, coefficient for all 1-vs-1 classifiers.
The layout of the coefficients in the multiclass case is somewhat
non-trivial. See the section about multi-class classification in the
SVM section of the User Guide for details.</p>
</dd>
<dt><strong>coef_</strong><span class="classifier">array, shape = [n_class * (n_class-1) / 2, n_features]</span></dt><dd><p>Weights assigned to the features (coefficients in the primal
problem). This is only available in the case of a linear kernel.</p>
<p><code class="docutils literal notranslate"><span class="pre">coef_</span></code> is a readonly property derived from <code class="docutils literal notranslate"><span class="pre">dual_coef_</span></code> and
<code class="docutils literal notranslate"><span class="pre">support_vectors_</span></code>.</p>
</dd>
<dt><strong>intercept_</strong><span class="classifier">ndarray of shape (n_class * (n_class-1) / 2,)</span></dt><dd><p>Constants in decision function.</p>
</dd>
<dt><strong>fit_status_</strong><span class="classifier">int</span></dt><dd><p>0 if correctly fitted, 1 otherwise (will raise warning)</p>
</dd>
<dt><strong>classes_</strong><span class="classifier">array of shape (n_classes,)</span></dt><dd><p>The classes labels.</p>
</dd>
<dt><strong>probA_</strong><span class="classifier">array, shape = [n_class * (n_class-1) / 2]</span></dt><dd></dd>
<dt><strong>probB_</strong><span class="classifier">array, shape = [n_class * (n_class-1) / 2]</span></dt><dd><p>If <code class="docutils literal notranslate"><span class="pre">probability=True</span></code>, it corresponds to the parameters learned in
Platt scaling to produce probability estimates from decision values.
If <code class="docutils literal notranslate"><span class="pre">probability=False</span></code>, it’s an empty array. Platt scaling uses the
logistic function
<code class="docutils literal notranslate"><span class="pre">1</span> <span class="pre">/</span> <span class="pre">(1</span> <span class="pre">+</span> <span class="pre">exp(decision_value</span> <span class="pre">*</span> <span class="pre">probA_</span> <span class="pre">+</span> <span class="pre">probB_))</span></code>
where <code class="docutils literal notranslate"><span class="pre">probA_</span></code> and <code class="docutils literal notranslate"><span class="pre">probB_</span></code> are learned from the dataset <a class="reference internal" href="#r20c70293ef72-2" id="id1"><span>[R20c70293ef72-2]</span></a>. For
more information on the multiclass case and training procedure see
section 8 of <a class="reference internal" href="#r20c70293ef72-1" id="id2"><span>[R20c70293ef72-1]</span></a>.</p>
</dd>
<dt><strong>class_weight_</strong><span class="classifier">ndarray of shape (n_class,)</span></dt><dd><p>Multipliers of parameter C for each class.
Computed based on the <code class="docutils literal notranslate"><span class="pre">class_weight</span></code> parameter.</p>
</dd>
<dt><strong>shape_fit_</strong><span class="classifier">tuple of int of shape (n_dimensions_of_X,)</span></dt><dd><p>Array dimensions of training vector <code class="docutils literal notranslate"><span class="pre">X</span></code>.</p>
</dd>
</dl>
</dd>
</dl>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><a class="reference internal" href="sklearn.svm.SVR.html#sklearn.svm.SVR" title="sklearn.svm.SVR"><code class="xref py py-obj docutils literal notranslate"><span class="pre">SVR</span></code></a></dt><dd><p>Support Vector Machine for Regression implemented using libsvm.</p>
</dd>
<dt><a class="reference internal" href="sklearn.svm.LinearSVC.html#sklearn.svm.LinearSVC" title="sklearn.svm.LinearSVC"><code class="xref py py-obj docutils literal notranslate"><span class="pre">LinearSVC</span></code></a></dt><dd><p>Scalable Linear Support Vector Machine for classification implemented using liblinear. Check the See also section of LinearSVC for more comparison element.</p>
</dd>
</dl>
</div>
<p class="rubric">References</p>
<dl class="citation">
<dt class="label" id="r20c70293ef72-1"><span class="brackets"><a class="fn-backref" href="#id2">R20c70293ef72-1</a></span></dt>
<dd><p><a class="reference external" href="http://www.csie.ntu.edu.tw/~cjlin/papers/libsvm.pdf">LIBSVM: A Library for Support Vector Machines</a></p>
</dd>
<dt class="label" id="r20c70293ef72-2"><span class="brackets"><a class="fn-backref" href="#id1">R20c70293ef72-2</a></span></dt>
<dd><p><a class="reference external" href="http://citeseer.ist.psu.edu/viewdoc/summary?doi=10.1.1.41.1639">Platt, John (1999). “Probabilistic outputs for support vector
machines and comparison to regularizedlikelihood methods.”</a></p>
</dd>
</dl>
<p class="rubric">Examples</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">X</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([[</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">],</span> <span class="p">[</span><span class="o">-</span><span class="mi">2</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">],</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">],</span> <span class="p">[</span><span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">]])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">y</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">array</span><span class="p">([</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">2</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">sklearn.svm</span> <span class="kn">import</span> <span class="n">SVC</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">clf</span> <span class="o">=</span> <span class="n">SVC</span><span class="p">(</span><span class="n">gamma</span><span class="o">=</span><span class="s1">&#39;auto&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">clf</span><span class="o">.</span><span class="n">fit</span><span class="p">(</span><span class="n">X</span><span class="p">,</span> <span class="n">y</span><span class="p">)</span>
<span class="go">SVC(gamma=&#39;auto&#39;)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">(</span><span class="n">clf</span><span class="o">.</span><span class="n">predict</span><span class="p">([[</span><span class="o">-</span><span class="mf">0.8</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">]]))</span>
<span class="go">[1]</span>
</pre></div>
</div>
<p class="rubric">Methods</p>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="#sklearn.svm.SVC.decision_function" title="sklearn.svm.SVC.decision_function"><code class="xref py py-obj docutils literal notranslate"><span class="pre">decision_function</span></code></a>(self, X)</p></td>
<td><p>Evaluates the decision function for the samples in X.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#sklearn.svm.SVC.fit" title="sklearn.svm.SVC.fit"><code class="xref py py-obj docutils literal notranslate"><span class="pre">fit</span></code></a>(self, X, y[, sample_weight])</p></td>
<td><p>Fit the SVM model according to the given training data.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#sklearn.svm.SVC.get_params" title="sklearn.svm.SVC.get_params"><code class="xref py py-obj docutils literal notranslate"><span class="pre">get_params</span></code></a>(self[, deep])</p></td>
<td><p>Get parameters for this estimator.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#sklearn.svm.SVC.predict" title="sklearn.svm.SVC.predict"><code class="xref py py-obj docutils literal notranslate"><span class="pre">predict</span></code></a>(self, X)</p></td>
<td><p>Perform classification on samples in X.</p></td>
</tr>
<tr class="row-odd"><td><p><a class="reference internal" href="#sklearn.svm.SVC.score" title="sklearn.svm.SVC.score"><code class="xref py py-obj docutils literal notranslate"><span class="pre">score</span></code></a>(self, X, y[, sample_weight])</p></td>
<td><p>Return the mean accuracy on the given test data and labels.</p></td>
</tr>
<tr class="row-even"><td><p><a class="reference internal" href="#sklearn.svm.SVC.set_params" title="sklearn.svm.SVC.set_params"><code class="xref py py-obj docutils literal notranslate"><span class="pre">set_params</span></code></a>(self, \*\*params)</p></td>
<td><p>Set the parameters of this estimator.</p></td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="sklearn.svm.SVC.__init__">
<code class="sig-name descname">__init__</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">C=1.0</em>, <em class="sig-param">kernel='rbf'</em>, <em class="sig-param">degree=3</em>, <em class="sig-param">gamma='scale'</em>, <em class="sig-param">coef0=0.0</em>, <em class="sig-param">shrinking=True</em>, <em class="sig-param">probability=False</em>, <em class="sig-param">tol=0.001</em>, <em class="sig-param">cache_size=200</em>, <em class="sig-param">class_weight=None</em>, <em class="sig-param">verbose=False</em>, <em class="sig-param">max_iter=-1</em>, <em class="sig-param">decision_function_shape='ovr'</em>, <em class="sig-param">break_ties=False</em>, <em class="sig-param">random_state=None</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/svm/_classes.py#L639"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.svm.SVC.__init__" title="Permalink to this definition">¶</a></dt>
<dd><p>Initialize self.  See help(type(self)) for accurate signature.</p>
</dd></dl>

<dl class="method">
<dt id="sklearn.svm.SVC.decision_function">
<code class="sig-name descname">decision_function</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">X</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/svm/_base.py#L537"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.svm.SVC.decision_function" title="Permalink to this definition">¶</a></dt>
<dd><p>Evaluates the decision function for the samples in X.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>X</strong><span class="classifier">array-like, shape (n_samples, n_features)</span></dt><dd></dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>X</strong><span class="classifier">array-like, shape (n_samples, n_classes * (n_classes-1) / 2)</span></dt><dd><p>Returns the decision function of the sample for each class
in the model.
If decision_function_shape=’ovr’, the shape is (n_samples,
n_classes).</p>
</dd>
</dl>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>If decision_function_shape=’ovo’, the function values are proportional
to the distance of the samples X to the separating hyperplane. If the
exact distances are required, divide the function values by the norm of
the weight vector (<code class="docutils literal notranslate"><span class="pre">coef_</span></code>). See also <a class="reference external" href="https://stats.stackexchange.com/questions/14876/interpreting-distance-from-hyperplane-in-svm">this question</a> for further details.
If decision_function_shape=’ovr’, the decision function is a monotonic
transformation of ovo decision function.</p>
</dd></dl>

<dl class="method">
<dt id="sklearn.svm.SVC.fit">
<code class="sig-name descname">fit</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">X</em>, <em class="sig-param">y</em>, <em class="sig-param">sample_weight=None</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/svm/_base.py#L107"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.svm.SVC.fit" title="Permalink to this definition">¶</a></dt>
<dd><p>Fit the SVM model according to the given training data.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>X</strong><span class="classifier">{array-like, sparse matrix}, shape (n_samples, n_features)</span></dt><dd><p>Training vectors, where n_samples is the number of samples
and n_features is the number of features.
For kernel=”precomputed”, the expected shape of X is
(n_samples, n_samples).</p>
</dd>
<dt><strong>y</strong><span class="classifier">array-like, shape (n_samples,)</span></dt><dd><p>Target values (class labels in classification, real numbers in
regression)</p>
</dd>
<dt><strong>sample_weight</strong><span class="classifier">array-like, shape (n_samples,)</span></dt><dd><p>Per-sample weights. Rescale C per sample. Higher weights
force the classifier to put more emphasis on these points.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>self</strong><span class="classifier">object</span></dt><dd></dd>
</dl>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>If X and y are not C-ordered and contiguous arrays of np.float64 and
X is not a scipy.sparse.csr_matrix, X and/or y may be copied.</p>
<p>If X is a dense array, then the other methods will not support sparse
matrices as input.</p>
</dd></dl>

<dl class="method">
<dt id="sklearn.svm.SVC.get_params">
<code class="sig-name descname">get_params</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">deep=True</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/base.py#L173"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.svm.SVC.get_params" title="Permalink to this definition">¶</a></dt>
<dd><p>Get parameters for this estimator.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>deep</strong><span class="classifier">bool, default=True</span></dt><dd><p>If True, will return the parameters for this estimator and
contained subobjects that are estimators.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>params</strong><span class="classifier">mapping of string to any</span></dt><dd><p>Parameter names mapped to their values.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="sklearn.svm.SVC.predict">
<code class="sig-name descname">predict</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">X</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/svm/_base.py#L568"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.svm.SVC.predict" title="Permalink to this definition">¶</a></dt>
<dd><p>Perform classification on samples in X.</p>
<p>For an one-class model, +1 or -1 is returned.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>X</strong><span class="classifier">{array-like, sparse matrix}, shape (n_samples, n_features)</span></dt><dd><p>For kernel=”precomputed”, the expected shape of X is
[n_samples_test, n_samples_train]</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>y_pred</strong><span class="classifier">array, shape (n_samples,)</span></dt><dd><p>Class labels for samples in X.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="sklearn.svm.SVC.predict_log_proba">
<em class="property">property </em><code class="sig-name descname">predict_log_proba</code><a class="headerlink" href="#sklearn.svm.SVC.predict_log_proba" title="Permalink to this definition">¶</a></dt>
<dd><p>Compute log probabilities of possible outcomes for samples in X.</p>
<p>The model need to have probability information computed at training
time: fit with attribute <code class="docutils literal notranslate"><span class="pre">probability</span></code> set to True.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>X</strong><span class="classifier">array-like, shape (n_samples, n_features)</span></dt><dd><p>For kernel=”precomputed”, the expected shape of X is
[n_samples_test, n_samples_train]</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>T</strong><span class="classifier">array-like, shape (n_samples, n_classes)</span></dt><dd><p>Returns the log-probabilities of the sample for each class in
the model. The columns correspond to the classes in sorted
order, as they appear in the attribute <a class="reference internal" href="../../glossary.html#term-classes"><span class="xref std std-term">classes_</span></a>.</p>
</dd>
</dl>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>The probability model is created using cross validation, so
the results can be slightly different than those obtained by
predict. Also, it will produce meaningless results on very small
datasets.</p>
</dd></dl>

<dl class="method">
<dt id="sklearn.svm.SVC.predict_proba">
<em class="property">property </em><code class="sig-name descname">predict_proba</code><a class="headerlink" href="#sklearn.svm.SVC.predict_proba" title="Permalink to this definition">¶</a></dt>
<dd><p>Compute probabilities of possible outcomes for samples in X.</p>
<p>The model need to have probability information computed at training
time: fit with attribute <code class="docutils literal notranslate"><span class="pre">probability</span></code> set to True.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>X</strong><span class="classifier">array-like, shape (n_samples, n_features)</span></dt><dd><p>For kernel=”precomputed”, the expected shape of X is
[n_samples_test, n_samples_train]</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>T</strong><span class="classifier">array-like, shape (n_samples, n_classes)</span></dt><dd><p>Returns the probability of the sample for each class in
the model. The columns correspond to the classes in sorted
order, as they appear in the attribute <a class="reference internal" href="../../glossary.html#term-classes"><span class="xref std std-term">classes_</span></a>.</p>
</dd>
</dl>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>The probability model is created using cross validation, so
the results can be slightly different than those obtained by
predict. Also, it will produce meaningless results on very small
datasets.</p>
</dd></dl>

<dl class="method">
<dt id="sklearn.svm.SVC.score">
<code class="sig-name descname">score</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">X</em>, <em class="sig-param">y</em>, <em class="sig-param">sample_weight=None</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/base.py#L344"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.svm.SVC.score" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the mean accuracy on the given test data and labels.</p>
<p>In multi-label classification, this is the subset accuracy
which is a harsh metric since you require for each sample that
each label set be correctly predicted.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>X</strong><span class="classifier">array-like of shape (n_samples, n_features)</span></dt><dd><p>Test samples.</p>
</dd>
<dt><strong>y</strong><span class="classifier">array-like of shape (n_samples,) or (n_samples, n_outputs)</span></dt><dd><p>True labels for X.</p>
</dd>
<dt><strong>sample_weight</strong><span class="classifier">array-like of shape (n_samples,), default=None</span></dt><dd><p>Sample weights.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>score</strong><span class="classifier">float</span></dt><dd><p>Mean accuracy of self.predict(X) wrt. y.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>

<dl class="method">
<dt id="sklearn.svm.SVC.set_params">
<code class="sig-name descname">set_params</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">**params</em><span class="sig-paren">)</span><a class="reference external" href="https://github.com/scikit-learn/scikit-learn/blob/5f3c3f037/sklearn/base.py#L205"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#sklearn.svm.SVC.set_params" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the parameters of this estimator.</p>
<p>The method works on simple estimators as well as on nested objects
(such as pipelines). The latter have parameters of the form
<code class="docutils literal notranslate"><span class="pre">&lt;component&gt;__&lt;parameter&gt;</span></code> so that it’s possible to update each
component of a nested object.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><dl class="simple">
<dt><strong>**params</strong><span class="classifier">dict</span></dt><dd><p>Estimator parameters.</p>
</dd>
</dl>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><dl class="simple">
<dt><strong>self</strong><span class="classifier">object</span></dt><dd><p>Estimator instance.</p>
</dd>
</dl>
</dd>
</dl>
</dd></dl>

</dd></dl>

<div class="section" id="examples-using-sklearn-svm-svc">
<h2>Examples using <code class="docutils literal notranslate"><span class="pre">sklearn.svm.SVC</span></code><a class="headerlink" href="#examples-using-sklearn-svm-svc" title="Permalink to this headline">¶</a></h2>
<div class="sphx-glr-thumbcontainer" tooltip="ROC Curve with Visualization API"><div class="figure align-default" id="id5">
<img alt="../../_images/sphx_glr_plot_roc_curve_visualization_api_thumb.png" src="../../_images/sphx_glr_plot_roc_curve_visualization_api_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/plot_roc_curve_visualization_api.html#sphx-glr-auto-examples-plot-roc-curve-visualization-api-py"><span class="std std-ref">ROC Curve with Visualization API</span></a></span><a class="headerlink" href="#id5" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This example simulates a multi-label document classification problem. The dataset is generated ..."><div class="figure align-default" id="id6">
<img alt="../../_images/sphx_glr_plot_multilabel_thumb.png" src="../../_images/sphx_glr_plot_multilabel_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/plot_multilabel.html#sphx-glr-auto-examples-plot-multilabel-py"><span class="std std-ref">Multilabel classification</span></a></span><a class="headerlink" href="#id6" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="An example illustrating the approximation of the feature map of an RBF kernel."><div class="figure align-default" id="id7">
<img alt="../../_images/sphx_glr_plot_kernel_approximation_thumb.png" src="../../_images/sphx_glr_plot_kernel_approximation_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/plot_kernel_approximation.html#sphx-glr-auto-examples-plot-kernel-approximation-py"><span class="std std-ref">Explicit feature map approximation for RBF kernels</span></a></span><a class="headerlink" href="#id7" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="An example showing how the scikit-learn can be used to recognize images of hand-written digits."><div class="figure align-default" id="id8">
<img alt="../../_images/sphx_glr_plot_digits_classification_thumb.png" src="../../_images/sphx_glr_plot_digits_classification_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/classification/plot_digits_classification.html#sphx-glr-auto-examples-classification-plot-digits-classification-py"><span class="std std-ref">Recognizing hand-written digits</span></a></span><a class="headerlink" href="#id8" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="Plot the classification probability for different classifiers. We use a 3 class dataset, and we..."><div class="figure align-default" id="id9">
<img alt="../../_images/sphx_glr_plot_classification_probability_thumb.png" src="../../_images/sphx_glr_plot_classification_probability_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/classification/plot_classification_probability.html#sphx-glr-auto-examples-classification-plot-classification-probability-py"><span class="std std-ref">Plot classification probability</span></a></span><a class="headerlink" href="#id9" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="A comparison of a several classifiers in scikit-learn on synthetic datasets. The point of this ..."><div class="figure align-default" id="id10">
<img alt="../../_images/sphx_glr_plot_classifier_comparison_thumb.png" src="../../_images/sphx_glr_plot_classifier_comparison_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/classification/plot_classifier_comparison.html#sphx-glr-auto-examples-classification-plot-classifier-comparison-py"><span class="std std-ref">Classifier comparison</span></a></span><a class="headerlink" href="#id10" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="Plot the decision boundaries of a VotingClassifier for two features of the Iris dataset."><div class="figure align-default" id="id11">
<img alt="../../_images/sphx_glr_plot_voting_decision_regions_thumb.png" src="../../_images/sphx_glr_plot_voting_decision_regions_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/ensemble/plot_voting_decision_regions.html#sphx-glr-auto-examples-ensemble-plot-voting-decision-regions-py"><span class="std std-ref">Plot the decision boundaries of a VotingClassifier</span></a></span><a class="headerlink" href="#id11" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="The dataset used in this example is a preprocessed excerpt of the &quot;Labeled Faces in the Wild&quot;, ..."><div class="figure align-default" id="id12">
<img alt="../../_images/sphx_glr_plot_face_recognition_thumb.png" src="../../_images/sphx_glr_plot_face_recognition_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/applications/plot_face_recognition.html#sphx-glr-auto-examples-applications-plot-face-recognition-py"><span class="std std-ref">Faces recognition example using eigenfaces and SVMs</span></a></span><a class="headerlink" href="#id12" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="A simple graphical frontend for Libsvm mainly intended for didactic purposes. You can create da..."><div class="figure align-default" id="id13">
<img alt="../../_images/sphx_glr_svm_gui_thumb.png" src="../../_images/sphx_glr_svm_gui_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/applications/svm_gui.html#sphx-glr-auto-examples-applications-svm-gui-py"><span class="std std-ref">Libsvm GUI</span></a></span><a class="headerlink" href="#id13" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="A recursive feature elimination example showing the relevance of pixels in a digit classificati..."><div class="figure align-default" id="id14">
<img alt="../../_images/sphx_glr_plot_rfe_digits_thumb.png" src="../../_images/sphx_glr_plot_rfe_digits_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/feature_selection/plot_rfe_digits.html#sphx-glr-auto-examples-feature-selection-plot-rfe-digits-py"><span class="std std-ref">Recursive feature elimination</span></a></span><a class="headerlink" href="#id14" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="A recursive feature elimination example with automatic tuning of the number of features selecte..."><div class="figure align-default" id="id15">
<img alt="../../_images/sphx_glr_plot_rfe_with_cross_validation_thumb.png" src="../../_images/sphx_glr_plot_rfe_with_cross_validation_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/feature_selection/plot_rfe_with_cross_validation.html#sphx-glr-auto-examples-feature-selection-plot-rfe-with-cross-validation-py"><span class="std std-ref">Recursive feature elimination with cross-validation</span></a></span><a class="headerlink" href="#id15" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="In order to test if a classification score is significative a technique in repeating the classi..."><div class="figure align-default" id="id16">
<img alt="../../_images/sphx_glr_plot_permutation_test_for_classification_thumb.png" src="../../_images/sphx_glr_plot_permutation_test_for_classification_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/feature_selection/plot_permutation_test_for_classification.html#sphx-glr-auto-examples-feature-selection-plot-permutation-test-for-classification-py"><span class="std std-ref">Test with permutations the significance of a classification score</span></a></span><a class="headerlink" href="#id16" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="Example of confusion matrix usage to evaluate the quality of the output of a classifier on the ..."><div class="figure align-default" id="id17">
<img alt="../../_images/sphx_glr_plot_confusion_matrix_thumb.png" src="../../_images/sphx_glr_plot_confusion_matrix_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/model_selection/plot_confusion_matrix.html#sphx-glr-auto-examples-model-selection-plot-confusion-matrix-py"><span class="std std-ref">Confusion matrix</span></a></span><a class="headerlink" href="#id17" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="In this plot you can see the training scores and validation scores of an SVM for different valu..."><div class="figure align-default" id="id18">
<img alt="../../_images/sphx_glr_plot_validation_curve_thumb.png" src="../../_images/sphx_glr_plot_validation_curve_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/model_selection/plot_validation_curve.html#sphx-glr-auto-examples-model-selection-plot-validation-curve-py"><span class="std std-ref">Plotting Validation Curves</span></a></span><a class="headerlink" href="#id18" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This examples shows how a classifier is optimized by cross-validation, which is done using the ..."><div class="figure align-default" id="id19">
<img alt="../../_images/sphx_glr_plot_grid_search_digits_thumb.png" src="../../_images/sphx_glr_plot_grid_search_digits_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/model_selection/plot_grid_search_digits.html#sphx-glr-auto-examples-model-selection-plot-grid-search-digits-py"><span class="std std-ref">Parameter estimation using grid search with cross-validation</span></a></span><a class="headerlink" href="#id19" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="Example of Receiver Operating Characteristic (ROC) metric to evaluate classifier output quality..."><div class="figure align-default" id="id20">
<img alt="../../_images/sphx_glr_plot_roc_crossval_thumb.png" src="../../_images/sphx_glr_plot_roc_crossval_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/model_selection/plot_roc_crossval.html#sphx-glr-auto-examples-model-selection-plot-roc-crossval-py"><span class="std std-ref">Receiver Operating Characteristic (ROC) with cross validation</span></a></span><a class="headerlink" href="#id20" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This example compares non-nested and nested cross-validation strategies on a classifier of the ..."><div class="figure align-default" id="id21">
<img alt="../../_images/sphx_glr_plot_nested_cross_validation_iris_thumb.png" src="../../_images/sphx_glr_plot_nested_cross_validation_iris_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/model_selection/plot_nested_cross_validation_iris.html#sphx-glr-auto-examples-model-selection-plot-nested-cross-validation-iris-py"><span class="std std-ref">Nested versus non-nested cross-validation</span></a></span><a class="headerlink" href="#id21" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="Example of Receiver Operating Characteristic (ROC) metric to evaluate classifier output quality..."><div class="figure align-default" id="id22">
<img alt="../../_images/sphx_glr_plot_roc_thumb.png" src="../../_images/sphx_glr_plot_roc_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/model_selection/plot_roc.html#sphx-glr-auto-examples-model-selection-plot-roc-py"><span class="std std-ref">Receiver Operating Characteristic (ROC)</span></a></span><a class="headerlink" href="#id22" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="Plotting Learning Curves"><div class="figure align-default" id="id23">
<img alt="../../_images/sphx_glr_plot_learning_curve_thumb.png" src="../../_images/sphx_glr_plot_learning_curve_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/model_selection/plot_learning_curve.html#sphx-glr-auto-examples-model-selection-plot-learning-curve-py"><span class="std std-ref">Plotting Learning Curves</span></a></span><a class="headerlink" href="#id23" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="In many real-world examples, there are many ways to extract features from a dataset. Often it i..."><div class="figure align-default" id="id24">
<img alt="../../_images/sphx_glr_plot_feature_union_thumb.png" src="../../_images/sphx_glr_plot_feature_union_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/compose/plot_feature_union.html#sphx-glr-auto-examples-compose-plot-feature-union-py"><span class="std std-ref">Concatenating multiple feature extraction methods</span></a></span><a class="headerlink" href="#id24" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="A demonstration of feature discretization on synthetic classification datasets. Feature discret..."><div class="figure align-default" id="id25">
<img alt="../../_images/sphx_glr_plot_discretization_classification_thumb.png" src="../../_images/sphx_glr_plot_discretization_classification_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/preprocessing/plot_discretization_classification.html#sphx-glr-auto-examples-preprocessing-plot-discretization-classification-py"><span class="std std-ref">Feature discretization</span></a></span><a class="headerlink" href="#id25" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="We are pleased to announce the release of scikit-learn 0.22, which comes with many bug fixes an..."><div class="figure align-default" id="id26">
<img alt="../../_images/sphx_glr_plot_release_highlights_0_22_0_thumb.png" src="../../_images/sphx_glr_plot_release_highlights_0_22_0_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/release_highlights/plot_release_highlights_0_22_0.html#sphx-glr-auto-examples-release-highlights-plot-release-highlights-0-22-0-py"><span class="std std-ref">Release Highlights for scikit-learn 0.22</span></a></span><a class="headerlink" href="#id26" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="Comparison for decision boundary generated on iris dataset between Label Propagation and SVM."><div class="figure align-default" id="id27">
<img alt="../../_images/sphx_glr_plot_label_propagation_versus_svm_iris_thumb.png" src="../../_images/sphx_glr_plot_label_propagation_versus_svm_iris_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/semi_supervised/plot_label_propagation_versus_svm_iris.html#sphx-glr-auto-examples-semi-supervised-plot-label-propagation-versus-svm-iris-py"><span class="std std-ref">Decision boundary of label propagation versus SVM on the Iris dataset</span></a></span><a class="headerlink" href="#id27" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="Plot the maximum margin separating hyperplane within a two-class separable dataset using a Supp..."><div class="figure align-default" id="id28">
<img alt="../../_images/sphx_glr_plot_separating_hyperplane_thumb.png" src="../../_images/sphx_glr_plot_separating_hyperplane_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/svm/plot_separating_hyperplane.html#sphx-glr-auto-examples-svm-plot-separating-hyperplane-py"><span class="std std-ref">SVM: Maximum margin separating hyperplane</span></a></span><a class="headerlink" href="#id28" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="Simple usage of Support Vector Machines to classify a sample. It will plot the decision surface..."><div class="figure align-default" id="id29">
<img alt="../../_images/sphx_glr_plot_custom_kernel_thumb.png" src="../../_images/sphx_glr_plot_custom_kernel_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/svm/plot_custom_kernel.html#sphx-glr-auto-examples-svm-plot-custom-kernel-py"><span class="std std-ref">SVM with custom kernel</span></a></span><a class="headerlink" href="#id29" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="The two plots differ only in the area in the middle where the classes are tied. If break_ties=F..."><div class="figure align-default" id="id30">
<img alt="../../_images/sphx_glr_plot_svm_tie_breaking_thumb.png" src="../../_images/sphx_glr_plot_svm_tie_breaking_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/svm/plot_svm_tie_breaking.html#sphx-glr-auto-examples-svm-plot-svm-tie-breaking-py"><span class="std std-ref">SVM Tie Breaking Example</span></a></span><a class="headerlink" href="#id30" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="Plot decision function of a weighted dataset, where the size of points is proportional to its w..."><div class="figure align-default" id="id31">
<img alt="../../_images/sphx_glr_plot_weighted_samples_thumb.png" src="../../_images/sphx_glr_plot_weighted_samples_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/svm/plot_weighted_samples.html#sphx-glr-auto-examples-svm-plot-weighted-samples-py"><span class="std std-ref">SVM: Weighted samples</span></a></span><a class="headerlink" href="#id31" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="Find the optimal separating hyperplane using an SVC for classes that are unbalanced."><div class="figure align-default" id="id32">
<img alt="../../_images/sphx_glr_plot_separating_hyperplane_unbalanced_thumb.png" src="../../_images/sphx_glr_plot_separating_hyperplane_unbalanced_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/svm/plot_separating_hyperplane_unbalanced.html#sphx-glr-auto-examples-svm-plot-separating-hyperplane-unbalanced-py"><span class="std std-ref">SVM: Separating hyperplane for unbalanced classes</span></a></span><a class="headerlink" href="#id32" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="Three different types of SVM-Kernels are displayed below. The polynomial and RBF are especially..."><div class="figure align-default" id="id33">
<img alt="../../_images/sphx_glr_plot_svm_kernels_thumb.png" src="../../_images/sphx_glr_plot_svm_kernels_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/svm/plot_svm_kernels.html#sphx-glr-auto-examples-svm-plot-svm-kernels-py"><span class="std std-ref">SVM-Kernels</span></a></span><a class="headerlink" href="#id33" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This example shows how to perform univariate feature selection before running a SVC (support ve..."><div class="figure align-default" id="id34">
<img alt="../../_images/sphx_glr_plot_svm_anova_thumb.png" src="../../_images/sphx_glr_plot_svm_anova_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/svm/plot_svm_anova.html#sphx-glr-auto-examples-svm-plot-svm-anova-py"><span class="std std-ref">SVM-Anova: SVM with univariate feature selection</span></a></span><a class="headerlink" href="#id34" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="A small value of C includes more/all the observations, allowing the margins to be calculated us..."><div class="figure align-default" id="id35">
<img alt="../../_images/sphx_glr_plot_svm_margin_thumb.png" src="../../_images/sphx_glr_plot_svm_margin_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/svm/plot_svm_margin.html#sphx-glr-auto-examples-svm-plot-svm-margin-py"><span class="std std-ref">SVM Margins Example</span></a></span><a class="headerlink" href="#id35" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="Comparison of different linear SVM classifiers on a 2D projection of the iris dataset. We only ..."><div class="figure align-default" id="id36">
<img alt="../../_images/sphx_glr_plot_iris_svc_thumb.png" src="../../_images/sphx_glr_plot_iris_svc_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/svm/plot_iris_svc.html#sphx-glr-auto-examples-svm-plot-iris-svc-py"><span class="std std-ref">Plot different SVM classifiers in the iris dataset</span></a></span><a class="headerlink" href="#id36" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="This example illustrates the effect of the parameters gamma and C of the Radial Basis Function ..."><div class="figure align-default" id="id37">
<img alt="../../_images/sphx_glr_plot_rbf_parameters_thumb.png" src="../../_images/sphx_glr_plot_rbf_parameters_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/svm/plot_rbf_parameters.html#sphx-glr-auto-examples-svm-plot-rbf-parameters-py"><span class="std std-ref">RBF SVM parameters</span></a></span><a class="headerlink" href="#id37" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="A tutorial exercise using Cross-validation with an SVM on the Digits dataset."><div class="figure align-default" id="id38">
<img alt="../../_images/sphx_glr_plot_cv_digits_thumb.png" src="../../_images/sphx_glr_plot_cv_digits_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/exercises/plot_cv_digits.html#sphx-glr-auto-examples-exercises-plot-cv-digits-py"><span class="std std-ref">Cross-validation on Digits Dataset Exercise</span></a></span><a class="headerlink" href="#id38" title="Permalink to this image">¶</a></p>
</div>
</div><div class="sphx-glr-thumbcontainer" tooltip="A tutorial exercise for using different SVM kernels."><div class="figure align-default" id="id39">
<img alt="../../_images/sphx_glr_plot_iris_exercise_thumb.png" src="../../_images/sphx_glr_plot_iris_exercise_thumb.png" />
<p class="caption"><span class="caption-text"><a class="reference internal" href="../../auto_examples/exercises/plot_iris_exercise.html#sphx-glr-auto-examples-exercises-plot-iris-exercise-py"><span class="std std-ref">SVM Exercise</span></a></span><a class="headerlink" href="#id39" title="Permalink to this image">¶</a></p>
</div>
</div><div class="clearer"></div></div>
</div>


      </div>
    <div class="container">
      <footer class="sk-content-footer">
            &copy; 2007 - 2019, scikit-learn developers (BSD License).
          <a href="../../_sources/modules/generated/sklearn.svm.SVC.rst.txt" rel="nofollow">Show this page source</a>
      </footer>
    </div>
  </div>
</div>
<script src="../../_static/js/vendor/bootstrap.min.js"></script>

<script>
    window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
    ga('create', 'UA-22606712-2', 'auto');
    ga('set', 'anonymizeIp', true);
    ga('send', 'pageview');
</script>
<script async src='https://www.google-analytics.com/analytics.js'></script>


<script>
$(document).ready(function() {
    /* Add a [>>>] button on the top-right corner of code samples to hide
     * the >>> and ... prompts and the output and thus make the code
     * copyable. */
    var div = $('.highlight-python .highlight,' +
                '.highlight-python3 .highlight,' +
                '.highlight-pycon .highlight,' +
		'.highlight-default .highlight')
    var pre = div.find('pre');

    // get the styles from the current theme
    pre.parent().parent().css('position', 'relative');
    var hide_text = 'Hide prompts and outputs';
    var show_text = 'Show prompts and outputs';

    // create and add the button to all the code blocks that contain >>>
    div.each(function(index) {
        var jthis = $(this);
        if (jthis.find('.gp').length > 0) {
            var button = $('<span class="copybutton">&gt;&gt;&gt;</span>');
            button.attr('title', hide_text);
            button.data('hidden', 'false');
            jthis.prepend(button);
        }
        // tracebacks (.gt) contain bare text elements that need to be
        // wrapped in a span to work with .nextUntil() (see later)
        jthis.find('pre:has(.gt)').contents().filter(function() {
            return ((this.nodeType == 3) && (this.data.trim().length > 0));
        }).wrap('<span>');
    });

    // define the behavior of the button when it's clicked
    $('.copybutton').click(function(e){
        e.preventDefault();
        var button = $(this);
        if (button.data('hidden') === 'false') {
            // hide the code output
            button.parent().find('.go, .gp, .gt').hide();
            button.next('pre').find('.gt').nextUntil('.gp, .go').css('visibility', 'hidden');
            button.css('text-decoration', 'line-through');
            button.attr('title', show_text);
            button.data('hidden', 'true');
        } else {
            // show the code output
            button.parent().find('.go, .gp, .gt').show();
            button.next('pre').find('.gt').nextUntil('.gp, .go').css('visibility', 'visible');
            button.css('text-decoration', 'none');
            button.attr('title', hide_text);
            button.data('hidden', 'false');
        }
    });

	/*** Add permalink buttons next to glossary terms ***/
	$('dl.glossary > dt[id]').append(function() {
		return ('<a class="headerlink" href="#' +
			    this.getAttribute('id') +
			    '" title="Permalink to this term">¶</a>');
	});
  /*** Hide navbar when scrolling down ***/
  // Returns true when headerlink target matches hash in url
  (function() {
    hashTargetOnTop = function() {
        var hash = window.location.hash;
        if ( hash.length < 2 ) { return false; }

        var target = document.getElementById( hash.slice(1) );
        if ( target === null ) { return false; }

        var top = target.getBoundingClientRect().top;
        return (top < 2) && (top > -2);
    };

    // Hide navbar on load if hash target is on top
    var navBar = document.getElementById("navbar");
    var navBarToggler = document.getElementById("sk-navbar-toggler");
    var navBarHeightHidden = "-" + navBar.getBoundingClientRect().height + "px";
    var $window = $(window);

    hideNavBar = function() {
        navBar.style.top = navBarHeightHidden;
    };

    showNavBar = function() {
        navBar.style.top = "0";
    }

    if (hashTargetOnTop()) {
        hideNavBar()
    }

    var prevScrollpos = window.pageYOffset;
    hideOnScroll = function(lastScrollTop) {
        if (($window.width() < 768) && (navBarToggler.getAttribute("aria-expanded") === 'true')) {
            return;
        }
        if (lastScrollTop > 2 && (prevScrollpos <= lastScrollTop) || hashTargetOnTop()){
            hideNavBar()
        } else {
            showNavBar()
        }
        prevScrollpos = lastScrollTop;
    };

    /*** high preformance scroll event listener***/
    var raf = window.requestAnimationFrame ||
        window.webkitRequestAnimationFrame ||
        window.mozRequestAnimationFrame ||
        window.msRequestAnimationFrame ||
        window.oRequestAnimationFrame;
    var lastScrollTop = $window.scrollTop();

    if (raf) {
        loop();
    }

    function loop() {
        var scrollTop = $window.scrollTop();
        if (lastScrollTop === scrollTop) {
            raf(loop);
            return;
        } else {
            lastScrollTop = scrollTop;
            hideOnScroll(lastScrollTop);
            raf(loop);
        }
    }
  })();
});

</script>
    
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
    
</body>
</html>